<template>
    <div>
        <div class="container">
            <div class="handle-box">
                <el-select v-model="query.case_source" @change="handleSearch(query.case_number,query.tcs_note_id,query.case_source,query.case_type)" clearable placeholder="案件来源" class="handle-select mr10">
                    <el-option key="1" label="市场查获" value="市场查获"></el-option>
                    <el-option key="2" label="投诉举报" value="投诉举报"></el-option>
                    <el-option key="3" label="上级交办" value="上级交办"></el-option>
                </el-select>
                <el-select v-model="query.case_type" @change="handleSearch(query.case_number,query.tcs_note_id,query.case_source,query.case_type)" clearable placeholder="案件性质" class="handle-select mr10">
                    <el-option key="1" label="一般案件" value="一般案件"></el-option>
                    <el-option key="2" label="简易案件" value="简易案件"></el-option>
                </el-select>
                <el-input v-model="query.case_number" placeholder="立案编号" @change="handleSearch(query.case_number,query.tcs_note_id,query.case_source,query.case_type)" class="handle-input mr10"></el-input>
                <el-button type="primary" :icon="Search" @change="handleSearch(query.case_number,query.tcs_note_id,query.case_source,query.case_type)">搜索</el-button>
            </div>
            <el-table :data="tableList" border class="table" ref="multipleTable" header-cell-class-name="table-header">
                <!--        <el-table-column prop="case_id" label="案件号" width="100" align="center"></el-table-column>-->
                <el-table-column prop="case_source" label="案件来源"  align="center"></el-table-column>
                <el-table-column prop="case_number" label="立案编号" width="200" align="center"></el-table-column>
                <el-table-column prop="case_update_time" label="更新时间"  align="center"></el-table-column>
                <el-table-column prop="case_type" label="案件性质" align="center"></el-table-column>
                <el-table-column prop="date_of_filing" label="立案日期"  align="center"></el-table-column>
                <el-table-column label="集体讨论状态" align="center" width="180">
                    <template #default="scope">
                        <div v-if="scope.row.tcs_note_id === '调查终结文书已完成' ">
                            <el-tag :type=" 'danger'">调查终结文书已完成 </el-tag>
                        </div>
                        <div v-if="scope.row.tcs_note_id === '撤案集体讨论准备' ">
                            <el-tag :type=" 'danger'">撤案集体讨论准备</el-tag>
                        </div>
                        <div v-if="scope.row.tcs_note_id === '撤案集体讨论已开始' ">
                            <el-tag :type=" 'danger'">撤案集体讨论已开始</el-tag>
                        </div>
                        <div v-if="scope.row.tcs_note_id === '集体讨论已开始' ">
                            <el-tag :type=" 'danger'">集体讨论已开始 </el-tag>
                        </div>
                        <div v-if="scope.row.tcs_note_id === '集体讨论已完成' ">
                            <el-tag :type=" 'danger'">集体讨论已完成 </el-tag>
                        </div>
                        <div v-if="scope.row.tcs_note_id === '已完成' ||
                                scope.row.tcs_note_id === '无证经营公示已完成' ||
                                scope.row.tcs_note_id ==='案件处理审批已开始'||
                                scope.row.tcs_note_id ==='听证已开始'||
                                scope.row.tcs_note_id ==='听证告知书已完成'||
                                scope.row.tcs_note_id ==='听证已完成'||
                                scope.row.tcs_note_id ==='案件处理审批已完成'||
                                scope.row.tcs_note_id ==='行政处罚事先告知书确认完成'||
                                scope.row.tcs_note_id ==='行政处罚事先告知书已完成'||
                                scope.row.tcs_note_id ==='行政处罚决定书确认完成'||
                                scope.row.tcs_note_id ==='行政处罚决定书已完成'||
                                scope.row.tcs_note_id ==='行政罚款收据上传完成'||
                                scope.row.tcs_note_id ==='行政罚款收据已完成'||
                                scope.row.tcs_note_id ==='结案报告表已完成'">
                            <el-tag :type=" 'success'">已完成 </el-tag>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="下一步操作" width="300" align="center">
                    <template #default="scope">
                        <div v-if="scope.row.tcs_note_id === '调查终结文书已完成'||scope.row.tcs_note_id === '撤案集体讨论准备' ">
                            <el-button text :icon="Edit" class="blue" @click="agree_discuss(scope.row)" >
                                讨论
                            </el-button>
                            <el-button text :icon="Edit" class="blue" @click="refuse_discuss(scope.row)" >
                                不讨论
                            </el-button>
                        </div>
                        <div v-if="scope.row.tcs_note_id === '集体讨论已开始'|| scope.row.tcs_note_id === '撤案集体讨论已开始'">
                            <el-button text :icon="Edit" class="blue" @click="collective_discuss(scope.row)" >
                                集体讨论信息查看及确认
                            </el-button>
                        </div>


                        <div v-if="scope.row.tcs_note_id === '集体讨论已完成' ">
                            <el-button text :icon="Edit" class="blue" @click="agree_hearing(scope.row)" >
                                听证
                            </el-button>
                            <el-button text :icon="Edit" class="blue" @click="refuse_hearing(scope.row)" >
                                不听证
                            </el-button>
                        </div>

                        <div v-if="scope.row.tcs_note_id === '已完成' ||
                                scope.row.tcs_note_id === '无证经营公示已完成' ||
                                scope.row.tcs_note_id ==='案件处理审批已开始'||
                                scope.row.tcs_note_id ==='听证已开始'||
                                scope.row.tcs_note_id ==='听证告知书已完成'||
                                scope.row.tcs_note_id ==='听证已完成'||
                                scope.row.tcs_note_id ==='案件处理审批已完成'||
                                scope.row.tcs_note_id ==='行政处罚事先告知书确认完成'||
                                scope.row.tcs_note_id ==='行政处罚事先告知书已完成'||
                                scope.row.tcs_note_id ==='行政处罚决定书确认完成'||
                                scope.row.tcs_note_id ==='行政处罚决定书已完成'||
                                scope.row.tcs_note_id ==='行政罚款收据上传完成'||
                                scope.row.tcs_note_id ==='行政罚款收据已完成'||
                                scope.row.tcs_note_id ==='结案报告表已完成'">
                            <el-button text :icon="Edit" class="blue" @click="collective_discuss_browse(scope.row)" >
                                查看集体讨论信息
                            </el-button>
                        </div>

                    </template>
                </el-table-column>
            </el-table>
          <div class="pagination">
            <el-pagination
                background
                layout="total, prev, pager, next"
                :current-page="query.pageIndex"
                :page-size="query.pageSize"
                :total="pageTotal"
                @current-change="handlePageChange"
            ></el-pagination>
          </div>
        </div>

        <el-dialog title="案件调查情况" v-model="investigateVisible" width="50%">
            <el-form label-width="80px">
                <el-form-item label="发言会议">
                    <el-input v-model="collective_discuss_data_storage.speak_session"  :disabled="true"></el-input>
                </el-form-item>
                <el-form-item label="发言类型">
                    <el-input  v-model="collective_discuss_data_storage.investigate_case" :disabled="true"></el-input>
                </el-form-item>

                <el-form-item label="发言内容">
                    <el-input type="textarea" rows="20" v-model="collective_discuss_data_storage.investigate_content"></el-input>
                </el-form-item>
<!--                <el-form-item >-->
<!--                    <el-button  type="primary" >默认内容</el-button>-->
<!--                </el-form-item>-->
            </el-form>
            <template #footer>
				<span class="dialog-footer">
					<el-button @click="investigateVisible = false">取 消</el-button>
					<el-button type="primary" @click="saveInvestigate">确 定</el-button>
				</span>
            </template>
        </el-dialog>

        <el-dialog title="其他发言" v-model="otherSpeakVisible" width="50%">
            <el-form label-width="80px">
                <el-form-item label="发言会议">
                    <el-input v-model="collective_discuss_data_storage.speak_session"  :disabled="true"></el-input>
                </el-form-item>
                <el-row :gutter="24">
                    <el-col :span="500">
                        <el-form-item label="发言类型" >
                            <el-select v-model="collective_discuss_data_storage.other_speak" clearable filterable  placeholder="请选择" class="handle-select mr10">
                                <el-option key="1" label="普通发言" value="普通发言" ></el-option>
                                <el-option key="2" label="汇报拟作出的行政处罚意见" value="汇报拟作出的行政处罚意见"></el-option>
                                <el-option key="3" label="结论性意见" value="结论性意见"></el-option>
                            </el-select>
                        </el-form-item>

                    </el-col >
<!--                    <div  align="right">-->
<!--                        <el-button  type="primary" >默认内容</el-button>-->
<!--                    </div>-->
                </el-row>


                <el-form-item label="发言内容">
                    <el-input type="textarea" rows="20" v-model="collective_discuss_data_storage.speak_content"></el-input>
                </el-form-item>

            </el-form>
            <template #footer>
				<span class="dialog-footer">
					<el-button @click="investigateVisible = false">取 消</el-button>
					<el-button type="primary" @click="saveOtherSpeak">确 定</el-button>
				</span>
            </template>
        </el-dialog>

        <el-dialog title="发言内容修改" v-model="speakEditVisible" width="50%">
            <el-form label-width="80px">
                <el-form-item label="发言会议">
                    <el-input v-model="speak_data_edit.speak_meeting"  :disabled="true"></el-input>
                </el-form-item>
                <el-form-item label="发言类型">
                    <el-input v-model="speak_data_edit.speak_type"  :disabled="true"></el-input>
                </el-form-item>

                <el-form-item label="发言内容">
                    <el-input v-model="speak_data_edit.speak_content" type="textarea" rows="20" ></el-input>
                </el-form-item>

            </el-form>
            <template #footer>
				<span class="dialog-footer">
					<el-button @click="speakEditVisible = false">取 消</el-button>
					<el-button type="primary" @click="saveSpeakEdit">确 定</el-button>
				</span>
            </template>
        </el-dialog>


        <el-dialog title="集体讨论" v-model="Dollective_discuss_Visible" width="60%">
            <el-form ref="form"  :model="form" label-width="100px">
                <el-row >
                    <el-col :span="8">
                        <el-form-item label="案由">
                            <el-input v-model="collective_discuss_data_storage.case_cause" :disabled="true" ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="立案编号">
                            <el-input v-model="collective_discuss_data_storage.case_number" :disabled="true"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="当事人">
                            <el-input v-model="collective_discuss_data_storage.tir_person" :disabled="true"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="8">
                <el-form-item label="开始时间">
                    <el-date-picker v-model="collective_discuss_data_storage.start_date_of_filing" type="datetime" placeholder="选择会议开始时间" value-format="YYYY-MM-DD HH:mm:ss">
                    </el-date-picker>
                </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="结束时间">
                            <el-date-picker v-model="collective_discuss_data_storage.end_date_of_filing"  type="datetime" placeholder="选择会议结束时间" value-format="YYYY-MM-DD HH:mm:ss">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="犯案次数">
                            <el-input v-model="collective_discuss_data_storage.crime_number" placeholder="输入当事人两年内犯案次数" ></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row >
                    <el-col :span="8">
                        <el-form-item label="地点">
                            <el-input v-model="collective_discuss_data_storage.discuss_address" ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="主持人">
                            <el-select v-model="collective_discuss_data_storage.host_staff" @change="get_interrogator_clause_opinion(collective_discuss_data_storage.host_staff)" clearable filterable placeholder="请选择">
                                <el-option
                                        v-for="(item,index) in interrogator_Data"
                                        :key='index'
                                        :label='item.staff_name'
                                        :value='item.staff_id'
                                ></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="记录人">
                            <el-select v-model="collective_discuss_data_storage.recorder_staff"  @change="get_interrogator_clause_opinion(collective_discuss_data_storage.recorder_staff)" clearable filterable placeholder="请选择">
                                <el-option
                                        v-for="(item,index) in interrogator_Data"
                                        :key='index'
                                        :label='item.staff_name '
                                        :value='item.staff_id'
                                ></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="24">
                    <el-col :span="500">
                        <el-form-item label="出席人员" >
                            <el-select v-model="collective_discuss_data_storage.attend_person"  @change="get_attend_person_data(collective_discuss_data_storage.attend_person)" clearable filterable placeholder="请选择">
                                <el-option
                                        v-for="(item,index) in attend_person_Data"
                                        :key='index'
                                        :label='item.staff_name_post'
                                        :value='item.staff_name_post'
                                ></el-option>
                            </el-select>
                        </el-form-item>

                    </el-col >
                    <div  align="right">
                        <el-button type="primary"  @click="attend_person_add">添加</el-button>
                    </div>
                </el-row>
                <el-form-item >
                    <el-input type="textarea" rows="2" class="el-input" v-model="collective_discuss_data_storage.attend_person_all"  placeholder="请输入出席人员"></el-input>
                </el-form-item>

                <el-row :gutter="24">
                    <el-col :span="500">
                        <el-form-item label="列席人员" >
                            <el-select v-model="collective_discuss_data_storage.sit_attend_person"  @change="get_attend_person_data(collective_discuss_data_storage.sit_attend_person)" clearable filterable placeholder="请选择">
                                <el-option
                                        v-for="(item,index) in attend_person_Data"
                                        :key='index'
                                        :label='item.staff_name_post'
                                        :value='item.staff_name_post'
                                ></el-option>
                            </el-select>
                        </el-form-item>

                    </el-col >
                    <div  align="right">
                        <el-button type="primary"  @click="sit_attend_person_add">添加</el-button>
                    </div>
                </el-row>
                <el-form-item >
                    <el-input type="textarea" rows="2" class="el-input" v-model="collective_discuss_data_storage.sit_attend_person_all"  placeholder="请输入列席人员"></el-input>
                </el-form-item>
                <el-row :gutter="24">
                  <el-col :span="500">
                    <el-form-item label="处罚决定" >
                      <el-select v-model="collective_discuss_data_storage.punish_decision" @change="get_illegal_behavior_clause_opinion(collective_discuss_data_storage.punish_decision)" clearable filterable placeholder="请选择">
                        <el-option
                                v-for="item in legal_clause_Data"
                                :key="item.penalty_range"
                                :label="item.penalty_range"
                                :value="item.penalty_range"
                        ></el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <div align="right">
                    <el-button type="primary"  @click="add_illegal_behavior">添加</el-button>
                  </div>
                </el-row>
                <el-form-item >
                    <el-input type="textarea" rows="3"  v-model="collective_discuss_data_storage.punish_decision1" ></el-input>
                </el-form-item>
                <el-row :gutter="24">
                    <el-col :span="500">
                        <el-form-item label="发言" >
                            <el-select v-model="collective_discuss_data_storage.spokesman"  @change="get_interrogator_clause_opinion(collective_discuss_data_storage.spokesman)" clearable filterable placeholder="请选择">
                                <el-option
                                        v-for="(item,index) in interrogator_Data"
                                        :key='index'
                                        :label='item.staff_name '
                                        :value='item.staff_id'
                                ></el-option>
                            </el-select>
                        </el-form-item>

                    </el-col >
                    <div  align="right">
                        <el-button type="primary"  @click="investigate_case_add">添加案件调查情况</el-button>
                    </div>
                    &nbsp;&nbsp;&nbsp;
                    <div  align="right">
                        <el-button type="primary"  @click="other_speak_add">添加其他发言</el-button>
                    </div>
                </el-row>
            </el-form>
            <el-table :data="speak_Data" border class="table" ref="multipleTable" header-cell-class-name="table-header" >
                <!--            <el-table-column prop="id" label="序号"  width="55px" align="center"></el-table-column>-->
                <el-table-column prop="speak_meeting"  label="发言会议"   align="center"></el-table-column>
                <el-table-column prop="staff_name" label="发言人"   align="center"></el-table-column>
                <el-table-column prop="speak_type" label="发言类型"   align="center"></el-table-column>
                <el-table-column label="操作" width="200px"  align="center">
                    <template #default="scope">
                        <el-button text :icon="Edit" @click="speakEdit(scope.$index,scope.row)" >
                            修改
                        </el-button>
                        <el-button text :icon="Delete" class="red" @click="speak_data_delete(scope.$index,scope.row)" >
                            删除
                        </el-button>
                    </template>
                </el-table-column>
            </el-table>
            <template #footer>
              <span class="dialog-footer">
                  <el-button @click="Dollective_discuss_Visible = false">取 消</el-button>
        <el-button type="primary" @click="certain_collective_discuss">确 定</el-button>
              </span>
            </template>
        </el-dialog>


        <el-dialog  v-model="Collective_discuss_list_Browse_Visible" width="50%">
            <html>
            <head>
                <title>重大案件集体讨论记录</title>
            </head>
            <body>
            <h1 align="center">
                福建省闽侯县烟草专卖局
            </h1>
            <h2 align="center">
                重大案件集体讨论记录
            </h2>
            <br>
            <div >
                <font size="3">
                    <b>案 由：</b>{{collective_discuss_browse_data.case_cause}}
                </font>
            </div>
            <div >
                <font size="3">
                    <b> 立案编号：</b>侯烟处[{{collective_discuss_browse_data.year}}]第{{collective_discuss_browse_data.case_number}}号
                </font>
            </div>
            <div >
                <font size="3" >
                    <b>当事人：</b>{{collective_discuss_browse_data.tir_person}}
                </font>
            </div>
            <div >
                <font size="3">
                    <b> 时 间：</b>{{collective_discuss_browse_data.year1}}年{{collective_discuss_browse_data.month1}}月{{collective_discuss_browse_data.day1}}日{{collective_discuss_browse_data.hour1}}时{{collective_discuss_browse_data.min1}}分&nbsp;-&nbsp;
                    {{collective_discuss_browse_data.year2}}年{{collective_discuss_browse_data.month2}}月{{collective_discuss_browse_data.day2}}日{{collective_discuss_browse_data.hour2}}时{{collective_discuss_browse_data.min2}}分
                </font>
            </div>
            <div >
                <font size="3">
                    <b> 地点：</b>{{collective_discuss_browse_data.discuss_address}}
                </font>
            </div>
            <div >
                <font size="3">
                    <b> 主持人：</b>{{collective_discuss_browse_data.staff_host_name}} &nbsp;&nbsp;<b>职务：</b>{{collective_discuss_browse_data.host_degree}}&nbsp;&nbsp;<b>记录人：</b>{{collective_discuss_browse_data.recorder_name}}
                </font>
            </div>
            <div >
                <font size="3">
                    <b>出席人员姓名及职务：</b>{{collective_discuss_browse_data.attend_person_all}}
                </font>
            </div>
            <div >
                <font size="3">
                    <b>列席人员姓名及职务：</b>{{collective_discuss_browse_data.sit_attend_person_all}}
                </font>
            </div>
                <br>
            <div v-for="item in collective_discuss_browse_data.list1">
                <font size="3">
                    {{item.staff_name}}{{item.speak_type}}：</font><br>
                <font size="3">
                    &emsp;&emsp;{{group_discussion_storage_data.year}}年{{group_discussion_storage_data.month}}月{{group_discussion_storage_data.day}}日,我局专卖执法人员在闽侯县进行市场检查,检查至{{group_discussion_storage_data.mer_address}},
                    依法对{{group_discussion_storage_data.mer_name}}的当事人{{group_discussion_storage_data.tir_person}}出示执法检查证件表明身份后，依法对该店铺进行检查，在该店卷烟柜台内发现一批未印有“由中国烟草总公司专卖”字样的外国卷烟，品种数量如下：
                    {{group_discussion_storage_data.ciga_data_all}}，总计{{group_discussion_storage_data.tce_type_number_chinese}}品种{{group_discussion_storage_data.tce_number_chinese}}（具体品种详见先行登记保存通知书，单号：{{group_discussion_storage_data.evi_data_all}}）。
                    由于当事人无法提供购买该批卷烟的合法有效证明，涉嫌{{group_discussion_storage_data.illegal_behavior}}的行为。为了保全证据，我局专卖执法人员对现场执法情况拍照留证，经本局领导批准同意，我局专卖执法人员依法对上述卷烟予以先行登记保存，同时制作检查（勘验）笔录，交当事人{{group_discussion_storage_data.tir_person}}核对无异议后签字确认。<br>
                    &emsp;&emsp;本局于{{group_discussion_storage_data.year}}年{{group_discussion_storage_data.month}}月{{group_discussion_storage_data.day}}日对该案进行立案调查。{{group_discussion_storage_data.year1}}年{{group_discussion_storage_data.month1}}月{{group_discussion_storage_data.day1}}日
                    {{group_discussion_storage_data.tir_person}}前来我局接受询问调查。现查实：当事人为了牟取非法利益，{{group_discussion_storage_data.cigarette_origin}}我局卷烟真伪鉴别小组，鉴定该批涉案卷烟{{group_discussion_storage_data.evi_ciga_t}}、{{group_discussion_storage_data.evi_ciga_f}}，
                    当事人对鉴别结论没有异议。因当事人未供述购进价格，无法提供相关账册发票等证据进行印证,故我局核价小组根据福建省烟草专卖局公布的价格信息，以案发当日作为核价基准日进行计算，核定违法卷烟价值计人民币{{group_discussion_storage_data.tce_amount_chinese}}(人民币{{group_discussion_storage_data.tce_amount}}元)。<br>
                    &emsp;&emsp;以上事实，有下列我局执法人员采集的与本案相关的证据为证：<br>
                    &emsp;&emsp;证据（一）我局专卖执法人员制作的关于当事人经营场所《检查（勘验）笔录》一份，证明当事人从事违规卷烟销售及现场检查情况。<br>
                    &emsp;&emsp;证据（二）我局专卖执法人员制作的《先行登记保存批准书》（{{group_discussion_storage_data.evi_data_all_1}}），《先行登记保存通知书》（{{group_discussion_storage_data.evi_data_all}}）各{{group_discussion_storage_data.num1}}份，证明当事人经营场所查获涉案卷烟的品种、规格及数量。<br>
                    &emsp;&emsp;证据（三）我局专卖执法人员现场拍摄的当事人经营场所及卷烟等《现场照片》一组，证明当事人经营场所现场及卷烟有关情况。<br>
                    &emsp;&emsp;证据（四）当事人来接受调查时提供的当事人身份证复印件一份，烟草专卖零售许可证复印件一份，证明当事人从业资格、身份。<br>
                    &emsp;&emsp;证据（五）当事人来接受调查时，我局执法人员制作并由当事人签字确认的《询问（调查）笔录》一份，证明当事人从事违规卷烟进销的具体情况。<br>
                    &emsp;&emsp;证据（六）我局卷烟真伪鉴别小组对涉案卷烟进行鉴别，制作并由当事人签字确认的《卷烟产品鉴别书》一份，证明该批卷烟为真假性。<br>
                    &emsp;&emsp;证据（七）我局卷烟价格核价小组制作涉案物品核价表一份，证明该批卷烟价格情况。<br>
                    &emsp;&emsp;以上事实清楚，证据确凿，足以认定当事人{{group_discussion_storage_data.tir_person}}的行为违反了{{group_discussion_storage_data.violate_law}}的规定，构成了{{group_discussion_storage_data.illegal_behavior}}的事实。
                </font>

            </div>
            <br>
            <div v-for="item in collective_discuss_browse_data.list2">
                <font size="3">
                    {{item.staff_name}}{{item.speak_type}}：</font><br>
                <font size="3">
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{item.speak_content}}
                </font>
            </div>
            <br>
            <div v-for="item in collective_discuss_browse_data.list3">
                <font size="3">
                    {{item.staff_name}}发言：</font><br>
                <font size="3">
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{item.speak_content}}
                </font>
            </div>
            <br>
            <div v-for="item in collective_discuss_browse_data.list4">
                <font size="3">
                    {{item.staff_name}}{{item.speak_type}}：</font><br>
                <font size="3">
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{item.speak_content}}
                </font>
            </div>
            <br><br>
            <div>
            <font size="3">
                与会人员签署意见并签名：___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________


            </font >
            </div>
            </body>

            </html>
            <template #footer>
        <span class="dialog-footer">
            <el-button @click="Collective_discuss_list_Browse_Visible=false" >取 消</el-button>
                <el-button type="primary" :icon="Printer"  @click="group_discuss_print" >
                打 印
              </el-button>
        </span>
            </template>
        </el-dialog>




    </div>
</template>

<script setup lang="ts" name="basetable">
import { ref, reactive } from 'vue';
import { ElMessage, ElMessageBox } from 'element-plus';
import { Delete, Edit, Search, Plus,Printer } from '@element-plus/icons-vue';
import {
    case_evi_Create,
    case_evi_Views,
    case_legal_Create,
    ciga_evudence_Create,
    end_record_data,
    evi_Views,
    fetchData_case,
    fetchData_case_Create,
    fetchData_case_update,
    fetchData_legal_clause,
    fetchData_mer,
    fetchData_s_mongodb_evidence_Cre,
    fetchData_s_mongodb_evidence_Views,
    fetchData_tobacco,
    fetchData_user,
    illegal_record_data,
    illegal_record_Search,
    mer_Create,
    mer_search_api,
    review_price_data,
    staff_evidence_create,
    staff_evidence_data,
    end_record_show,
    record_inquiry_show,
    record_inquiry_print,
    case_evidence_Views,
    case_evidence_Edit,
    question_answer_clause_delete,
    price_review_clause_delete,
    fetchData_user_Edit,
    fetchData_price_Edit,
    fetchData_interrogator_clause,
    fetchData_recorder_clause,
    fetchData_attend_person_clause,
    add_person,
    collective_discuss_data,
    fetchData_inquiry_record_Confirm,
    fetchData_collective_discuss_Confirm,
    fetData_save_investigate,
    fetData_save_other_Speak,
    question_answer_show,
    speak_data_show,
    speak_data_clause_delete,
    fetchData_question_answer_Edit,
    fetchData_save_Speak_Edit,
    group_discuss_print_data,
    case_handing_browse_data,
    group_discuss_browse_data,
    fetchData_illegal_behavior_clause,
    add_illegal_law_basis
} from '../api/index';
import {
    export_word_1, export_word_11, export_word_6,
} from './table_inquiry.vue'

//案件表数据
interface TableItem {
    case_id:number,
    date_of_filing:string,
    date_of_closing:string,
    date_of_archive:string,
    case_source:string,
    case_number:string,
    archive_person:string,
    case_update_time:string,
    ase_type:string,
    case_remark:string,
    tcs_note_id:string,
    ciga_flag:string,
    ciga_num_flag:string,
    mer_flag:string,
}

//案件暂存数据
const create_case = reactive({
    case_id:0,
    staff_evi_id:0,
    staff_id:0,
    staff_evi_send_per:'',
    staff_evi_check_per1:'',
    staff_evi_check_per2:'',
    staff_evi_send_time:'',
    staff_evi_send_unit:'',
    staff_evi_send_result:'',
    staff_evi_rec_address:'',
    staff_evi_status:'',
    staff_evi_per_note:'',
    mer_flag:'',
    ciga_num_flag:'',
    ciga_flag:'',
    test:[],
    img_data:'',
    standard:'',
    tir_id:0,
    tlc_id:0,
    illegal_behavior:'',
    evi_id_number:'',
    evi_id:'',
    date_of_filing:'',
    date_of_closing:'',
    date_of_archive:'',
    case_source:'',
    case_number:'',
    archive_person:'',
    case_update_time:'',
    case_type:'',
    case_remark:'',
    mer_id:0,
    tcs_note:'',
    tce_time:'',
    tce_number:0,
    tce_amount:0,
    tce_remark:'',
    tce_address:'福建省福州市闽侯县烟草专卖局',
    evi_number:0,//数量(条)
    ciga_variety:'',//品种
    barcode:'',//条形码
    ciga_model:'',//规格型号
    ciga_price:0,//单价
    inkjet:'',//
    mer_format:'',
    mer_address:'',
    mer_person:'',
    mer_record:'',
    date_of_record:'',
    date_of_effect:'',
    date_of_issue:'',
    mer_hometown:'',
    mer_id_number:'',
    mer_tel:'',
    business_licence_code:'',
    licence_state:'',
    storage_address:'',
    retail_licence_code:'',
    category:'',
    area_id:0,
    mer_zip_code:0,
    mer_name:'',
    remark:'',
    attend_person:'',//出席人员
    attend_person_all:'',
    recorder_staff:'',//记录人员

});



//视图/

const Ratification_Visible = ref(false);                              //批准书视图
const Ratification_Edit_Visible = ref(false);                         //批准书修改视图
const Advice_note_Visible = ref(false);                               //通知书视图
const Advice_note_Views_Visible = ref(false);                         //查看通知书视图
const Price_list_Visible = ref(false);                                //核价表视图
const Price_list_Browse_Visible = ref(false);                         //核价表视图
const Dollective_discuss_Visible=ref(false);                          //集体讨论视图
const investigateVisible=ref(false);                                  //调查情况视图
const otherSpeakVisible=ref(false);                                  //其他发言视图
const speakEditVisible=ref(false);                                   //发言修改
const Collective_discuss_list_Browse_Visible=ref(false);             //集体讨论信息浏览


const collective_discuss_browse_data=reactive({
    case_cause:'',
    year:'',
    case_number:'',
    tir_person:'',
    year1:'',
    month1:'',
    day1:'',
    hour1:'',
    min1:'',
    year2:'',
    month2:'',
    day2:'',
    hour2:'',
    min2:'',
    discuss_address:'',
    staff_host_name:'',
    host_degree:'',
    recorder_name:'',
    attend_person_all:'',
    sit_attend_person_all:'',
    list1:[],
    list2:[],
    list3:[],
    list4:[],
    current_state:'',
})

const group_discussion_storage_data=reactive({
    case_cause:'',
    case_number:'',
    year:'',
    month:'',
    day:'',
    case_time:'',
    name:'',
    statutory_responsible_person:'',//法定负责人
    address:'',
    tel:'',
    tir_person:'',
    tir_gender:'',
    tir_nation:'',
    tir_id_number:'',
    retail_licence_code:'',
    telephone_number:'',
    crime_number:'',
    mer_address:'',
    mer_name:'',
    tce_type_number_chinese:'',
    tce_number_chinese:'',
    tce_type_number:0,
    tce_number:0,
    evi_data_all:'',//先行保存通知书号
    evi_data_all_1:'',//先行保存批准书号
    conspirator:'',//同案人
    ciga_data_all:'',//卷烟品种
    ciga_data_f:'',//假烟
    ciga_data_t:'',//真烟
    evi_ciga_f:'',
    evi_ciga_t:'',
    tce_amount:0,
    tce_amount_chinese:'',//价格中文写法
    num1:0,
    num2:0,
    year1:'',
    month1:'',
    day1:'',
    year2:'',
    month2:'',
    day2:'',
    // year3:'',
    // month3:'',
    // day3:'',
    tir_home:'',
    undertaker1:'',
    undertaker2:'',
    undertaker1_name:'',
    undertaker2_name:'',
    staff_license_no_1:'',
    staff_license_no_2:'',
    write_time:'',
    cigarette_origin:'',
    violate_law:'',
    punish_basis:'',//处罚依据
    discretionary_standard_name:'',//裁量标准
    discretionary_standard_grade:'',
    discretionary_standard_punish:'',
    discretionary_standard:'',
    penalty_money:'',//罚款
    penalty_decision:'',
    list1:[],
    list2:[],
    list3:[],
    list4:[],
    list5:[],
    list6:[],
    list7:[],
    penalty_money_all:0,
    penalty_money_all_chinese:'',
    tce_type_number_t_chinese: "",
    tce_number_t_chinese: "",
    tce_type_number_f_chinese: "",
    tce_number_f_chinese: "",
    illegal_behavior:'',
    evi_data_t : '',
    evi_data_f : '',
})

const case_group_discuss_tabel_browse = (row:any) =>{
    create_case.case_id = row.case_id;
    group_discussion_storage_data.ciga_data_all=''
    group_discussion_storage_data.evi_data_all =''
    group_discussion_storage_data.evi_data_all_1=''
    group_discussion_storage_data.ciga_data_t =''
    group_discussion_storage_data.evi_ciga_t =''
    group_discussion_storage_data.ciga_data_f =''
    group_discussion_storage_data.evi_ciga_f=''

    get_group_discuss_tabel_browse_data(row);
    Collective_discuss_list_Browse_Visible.value=true;
}

//获取违法事件信息选项
interface Legal_clause_data{
    tlc_id:number,
    illegal_behavior:string,
    grade:string,
    standard:string,
    penalty_range:string,
    statutory_penalty:string,
    remark:string,
    statutory_penalty_abbreviation:string,
}
const legal_clause_Data=ref<Legal_clause_data[]>([]);
const get_illegal_behavior_clause_opinion=()=>{
    fetchData_illegal_behavior_clause().then(res=>{
        legal_clause_Data.value=res.data.data
    })
}

const get_group_discuss_tabel_browse_data=(row:any)=>{
    group_discuss_browse_data(row.case_id).then(res=>{
        //case_handing_data_storage.case_cause=res.data.data.case_cause,
        group_discussion_storage_data.illegal_behavior=res.data.data.illegal_behavior
        group_discussion_storage_data.year=res.data.data.year,
            group_discussion_storage_data.month=res.data.data.month,
            group_discussion_storage_data.day=res.data.data.day,
            group_discussion_storage_data.case_number=res.data.data.case_number,
            group_discussion_storage_data.name=res.data.data.name,
            group_discussion_storage_data.statutory_responsible_person=res.data.data.statutory_responsible_person,
            group_discussion_storage_data.address=res.data.data.address,
            group_discussion_storage_data.tel=res.data.data.tel,
            group_discussion_storage_data.tir_person=res.data.data.tir_person,
            group_discussion_storage_data.tir_gender=res.data.data.tir_gender,
            group_discussion_storage_data.tir_nation=res.data.data.tir_nation,
            group_discussion_storage_data.tir_id_number=res.data.data.tir_id_number,
            group_discussion_storage_data.retail_licence_code=res.data.data.retail_licence_code,
            group_discussion_storage_data.tir_home=res.data.data.tir_home,
            group_discussion_storage_data.telephone_number=res.data.data.telephone_number,
            group_discussion_storage_data.conspirator=res.data.data.conspirator,
            group_discussion_storage_data.mer_address=res.data.data.mer_address,
            group_discussion_storage_data.mer_name=res.data.data.mer_name,
            group_discussion_storage_data.list2=res.data.data.list2,
            group_discussion_storage_data.tce_type_number_chinese=res.data.data.tce_type_number_chinese,
            group_discussion_storage_data.tce_number_chinese=res.data.data.tce_number_chinese,
            group_discussion_storage_data.list3=res.data.data.list3,
            group_discussion_storage_data.cigarette_origin=res.data.data.cigarette_origin,
            group_discussion_storage_data.list1=res.data.data.list1,
            group_discussion_storage_data.list4=res.data.data.list4,
            group_discussion_storage_data.list5=res.data.data.list5,
            group_discussion_storage_data.list6=res.data.data.list6,
            group_discussion_storage_data.list7=res.data.data.list7,
            group_discussion_storage_data.violate_law=res.data.data.violate_law,
            group_discussion_storage_data.num1=res.data.data.num1,
            group_discussion_storage_data.punish_basis=res.data.data.punish_basis,
            group_discussion_storage_data.crime_number=res.data.data.crime_number,
            group_discussion_storage_data.tce_amount_chinese=res.data.data.tce_amount_chinese,
            group_discussion_storage_data.tce_amount=res.data.data.tce_amount,
            group_discussion_storage_data.discretionary_standard_name=res.data.data.discretionary_standard_name,
            group_discussion_storage_data.discretionary_standard_grade=res.data.data.discretionary_standard_grade,
            group_discussion_storage_data.discretionary_standard_punish=res.data.data.discretionary_standard_punish,
            group_discussion_storage_data.penalty_decision=res.data.data.penalty_decision,
            group_discussion_storage_data.penalty_money=res.data.data.penalty_money,
            group_discussion_storage_data.penalty_money_all=res.data.data.penalty_money_all,
            group_discussion_storage_data.penalty_money_all_chinese=res.data.data.penalty_money_all_chinese,
            group_discussion_storage_data.tce_type_number_t_chinese=res.data.data.tce_type_number_t_chinese,
            group_discussion_storage_data.tce_type_number_f_chinese=res.data.data.tce_type_number_f_chinese,
            group_discussion_storage_data.undertaker1_name=res.data.data.undertaker1_name,
            group_discussion_storage_data.undertaker2_name=res.data.data.undertaker2_name,
            group_discussion_storage_data.staff_license_no_1=res.data.data.staff_license_no_1,
            group_discussion_storage_data.staff_license_no_2=res.data.data.staff_license_no_2,
            group_discussion_storage_data.year1=res.data.data.year1,
            group_discussion_storage_data.month1=res.data.data.month1,
            group_discussion_storage_data.day1=res.data.data.day1,
            group_discussion_storage_data.year2=res.data.data.year2,
            group_discussion_storage_data.month2=res.data.data.month2,
            group_discussion_storage_data.day2=res.data.data.day2,
            group_discussion_storage_data.tce_number_f_chinese=res.data.data.tce_number_f_chinese,
            group_discussion_storage_data.tce_number_t_chinese=res.data.data.tce_number_t_chinese,
            //所有烟草
            res.data.data.list2.forEach(function (item) {
                group_discussion_storage_data.ciga_data_all = group_discussion_storage_data.ciga_data_all + '“' + item.ciga_model + ' ' + item.ciga_variety +
                    '“'+item.evi_number+'条，'
            });
        //所有证据先行保存通知书
        res.data.data.list3.forEach(function (item) {
            group_discussion_storage_data.evi_data_all = group_discussion_storage_data.evi_data_all + '侯烟存通字【'+ group_discussion_storage_data.year +'】第'+
                item.evi_id_number + '号、'
        });
        //所有证据先行保存通知书
        res.data.data.list3.forEach(function (item) {
            group_discussion_storage_data.evi_data_all_1 = group_discussion_storage_data.evi_data_all_1 + '侯烟存准【'+ group_discussion_storage_data.year +'】第'+
                item.evi_id_number + '号、'
        });

        // 真烟
        res.data.data.list6.forEach(function (item) {
            group_discussion_storage_data.ciga_data_t = group_discussion_storage_data.ciga_data_t + '“' + item.ciga_model + ' ' + item.ciga_variety +
                '“'+item.evi_number+'条，'
        });

        //真烟数据＋先行保存通知书
        if (group_discussion_storage_data.ciga_data_t){
            group_discussion_storage_data.evi_ciga_t = "鉴定卷烟"+ group_discussion_storage_data.ciga_data_t +  "总计"+ group_discussion_storage_data.tce_type_number_t_chinese +
                "品种" + group_discussion_storage_data.tce_number_t_chinese + group_discussion_storage_data.evi_data_t +"为真品卷烟";
        }
        res.data.data.list4.forEach(function (item) {
            group_discussion_storage_data.ciga_data_f = group_discussion_storage_data.ciga_data_f + '“' + item.ciga_model + ' ' + item.ciga_variety +
                '“'+item.evi_number+'条，'
        });
        //假烟数据＋先行保存通知书
        if (group_discussion_storage_data.ciga_data_f){
            group_discussion_storage_data.evi_ciga_f = "鉴定卷烟"+ group_discussion_storage_data.ciga_data_f +  "总计"+ group_discussion_storage_data.tce_type_number_f_chinese+
                "品种" + group_discussion_storage_data.tce_number_f_chinese  + group_discussion_storage_data.evi_data_f +"为假冒注册商标且伪劣卷烟";
        }

    })
}
//添加违法事件
const add_illegal_behavior = () => {
    add_illegal_law_basis(collective_discuss_data_storage.punish_decision1, collective_discuss_data_storage.punish_decision).then(res => {
        collective_discuss_data_storage.punish_decision1 = res.data.data.add_information
    })
}

const get_collective_discuss_browse_data=()=>{
    group_discuss_print_data(create_case.case_id).then(res=>{
        collective_discuss_browse_data.case_cause=res.data.data.case_cause,
        collective_discuss_browse_data.year=res.data.data.year,
        collective_discuss_browse_data.case_number=res.data.data.case_number,
        collective_discuss_browse_data.tir_person=res.data.data.tir_person,
        collective_discuss_browse_data.year1=res.data.data.year1,
        collective_discuss_browse_data.month1=res.data.data.month1,
        collective_discuss_browse_data.day1=res.data.data.day1,
        collective_discuss_browse_data.hour1=res.data.data.hour1,
        collective_discuss_browse_data.min1=res.data.data.min1,
        collective_discuss_browse_data.year2=res.data.data.year2,
        collective_discuss_browse_data.month2=res.data.data.month2,
        collective_discuss_browse_data.day2=res.data.data.day2,
        collective_discuss_browse_data.hour2=res.data.data.hour2,
        collective_discuss_browse_data.min2=res.data.data.min2,
        collective_discuss_browse_data.discuss_address=res.data.data.discuss_address,
        collective_discuss_browse_data.staff_host_name=res.data.data.staff_host_name,
        collective_discuss_browse_data.host_degree=res.data.data.host_degree,
        collective_discuss_browse_data.recorder_name=res.data.data.recorder_name,
        collective_discuss_browse_data.attend_person_all=res.data.data.attend_person_all,
        collective_discuss_browse_data.sit_attend_person_all=res.data.data.sit_attend_person_all,
        collective_discuss_browse_data.list1=res.data.data.list1,
        collective_discuss_browse_data.list2=res.data.data.list2,
        collective_discuss_browse_data.list3=res.data.data.list3,
        collective_discuss_browse_data.list4=res.data.data.list4
    })
}


const group_discuss_print=()=>{
    export_word_11(
        collective_discuss_browse_data.case_cause,
        collective_discuss_browse_data.year,
        collective_discuss_browse_data.case_number,
        collective_discuss_browse_data.tir_person,
        collective_discuss_browse_data.year1,
        collective_discuss_browse_data.month1,
        collective_discuss_browse_data.day1,
        collective_discuss_browse_data.hour1,
        collective_discuss_browse_data.min1,
        collective_discuss_browse_data.year2,
        collective_discuss_browse_data.month2,
        collective_discuss_browse_data.day2,
        collective_discuss_browse_data.hour2,
        collective_discuss_browse_data.min2,
        collective_discuss_browse_data.discuss_address,
        collective_discuss_browse_data.staff_host_name,
        collective_discuss_browse_data.host_degree,
        collective_discuss_browse_data.recorder_name,
        collective_discuss_browse_data.attend_person_all,
        collective_discuss_browse_data.sit_attend_person_all,
        collective_discuss_browse_data.list1,
        group_discussion_storage_data.list2,
        group_discussion_storage_data.year,
        group_discussion_storage_data.month,
        group_discussion_storage_data.day,
        group_discussion_storage_data.mer_address,
        group_discussion_storage_data.mer_name,
        group_discussion_storage_data.tce_type_number_chinese,
        group_discussion_storage_data.tce_number_chinese,
        group_discussion_storage_data.illegal_behavior,
        group_discussion_storage_data.list3,
        group_discussion_storage_data.cigarette_origin,
        group_discussion_storage_data.list6,
        group_discussion_storage_data.tce_type_number_t_chinese,
        group_discussion_storage_data.tce_number_t_chinese,
        group_discussion_storage_data.list4,
        group_discussion_storage_data.tce_type_number_f_chinese,
        group_discussion_storage_data.tce_number_f_chinese,
        group_discussion_storage_data.tce_amount_chinese,
        group_discussion_storage_data.tce_amount,
        group_discussion_storage_data.num1,
        group_discussion_storage_data.violate_law,
        collective_discuss_browse_data.list2,
        collective_discuss_browse_data.list3,
        collective_discuss_browse_data.list4,
    )
}


//出席人员及列席人员选择框
interface attend_person_data{
    staff_id:number,
    staff_name:string,
    staff_name_post:string
}
const attend_person_Data=ref<attend_person_data[]>([]);
const get_attend_person_data=(staff_id:number,staff_name:string='',staff_name_post:string='')=>{
    fetchData_attend_person_clause(staff_id,staff_name,staff_name_post).then(res=>{
        attend_person_Data.value=res.data.data;
    })
}
get_attend_person_data();

//获取询问人
interface interrogator_data{
    staff_id:number,
    staff_name:string
}
//获取询问者选择框
const interrogator_Data=ref<interrogator_data[]>([]);
const get_interrogator_clause_opinion=(staff_id:number,staff_name:string='')=>{
    fetchData_interrogator_clause(staff_id,staff_name).then(res=>{
        interrogator_Data.value=res.data.data
    })
}
get_interrogator_clause_opinion()


const investigate_case_add=()=>{
    saveInvestigate();
    //investigateVisible.value=true;
}

const other_speak_add=()=>{
    otherSpeakVisible.value=true;
}

//获取记录人
interface recorder_data{
    staff_id:number,
    staff_name:string
}
//获取记录人选择框
const recorder_Data=ref<recorder_data[]>();
const get_recorder_clause_opinion=(staff_id:number,staff_name:string='')=>{
    fetchData_recorder_clause(staff_id,staff_name).then(res=>{
        recorder_Data.value=res.data.data
    })
}
get_recorder_clause_opinion()


//发言内容展示
interface Speak_data{
    id:number,
    staff_id:number,
    staff_name:string,
    speak_meeting:string,
    speak_type:string,
    speak_content:string
}
const speak_Data= ref<Speak_data[]>([]);
const get_speak_Data=()=>{
    speak_data_show(create_case.case_id,collective_discuss_data_storage.speak_session).then(res=>{
        speak_Data.value = res.data.data;
    })
}

//发言内容修改
let speak_data_edit=reactive({
    id:0,
    case_id:0,
    speak_meeting:'',
    speak_type:'',
    speak_content:'',

})
let idx1: number = -1;
const speakEdit=(index: number, row: any)=>{
    row.case_id=create_case.case_id;
    speak_data_edit.id=row.id;
    speak_data_edit.case_id=row.case_id;
    speak_data_edit.speak_meeting=row.speak_meeting;
    speak_data_edit.speak_type=row.speak_type;
    speak_data_edit.speak_content=row.speak_content;
    if (speak_data_edit.speak_type=="汇报案件调查情况"){
        speakEditVisible.value=false;
    }else {
        speakEditVisible.value=true;
    }

}

//保存编辑
const saveSpeakEdit=()=>{
    speakEditVisible.value=false;

    fetchData_save_Speak_Edit(
        speak_data_edit.id,
        speak_data_edit.speak_content
    ).then(res=>{
        if(res.data.message==="success"){
            getData();
            ElMessage.success('修改成功');
        }else{
            ElMessageBox.confirm('修改失败', '提示', {
                type: 'warning'
            })
        }});


}


const attend_person_add=()=>{
    add_person(collective_discuss_data_storage.attend_person,collective_discuss_data_storage.attend_person_all).then(res=>{
        collective_discuss_data_storage.attend_person_all=res.data.data.attend_person_all;
    })
}
const sit_attend_person_add=()=>{
    add_person(collective_discuss_data_storage.sit_attend_person,collective_discuss_data_storage.sit_attend_person_all).then(res=>{
        collective_discuss_data_storage.sit_attend_person_all=res.data.data.attend_person_all;
    })
}


const collective_discuss_data_storage=reactive({
    case_cause:'',
    case_number:'',
    tir_person:'',//当事人
    start_date_of_filing:'',//开始时间
    end_date_of_filing:'',//结束时间
    discuss_address:'闽商二楼会议室',//会议地点
    host_staff:'',//主持人
    recorder_staff:'',//记录人
    attend_person:'',//出席人员选项
    attend_person_all:'林丛(职务:局长)、张文(职务:副局长)、陈勇（职务:专卖办主任)',//出席人员总人数
    sit_attend_person:'',//列席人员选项
    sit_attend_person_all:'潘铭(职务:上街管理所所长)、陈秋俐(职务:案件审理员)',//列席人员总人数
    spokesman:'',//发言人
    investigate_case:'汇报案件调查情况',
    investigate_content:'',
    speak_session:'集体讨论',
    other_speak:'',//其他发言
    speak_content:'',//其他发言内容
    punish_decision:'',
    punish_decision1:'',
    crime_number:'',
})


const saveInvestigate=()=>{
    //investigateVisible.value=false;
    fetData_save_investigate(
        create_case.case_id,
        collective_discuss_data_storage.speak_session,//发言会议
        collective_discuss_data_storage.investigate_case,//发言类型
        collective_discuss_data_storage.spokesman,
        collective_discuss_data_storage.investigate_content,
    ).then(res=>{
        speak_Data.value=res.data.data;
        if (res.data.message === "success"){
            getData()
            ElMessage.success('添加成功');
        }else {
            ElMessageBox.confirm('添加失败', '提示', {
                type: 'warning'
            })
        }});
}

const saveOtherSpeak=()=>{
    otherSpeakVisible.value=false;
    fetData_save_other_Speak(
        create_case.case_id,
        collective_discuss_data_storage.speak_session,//发言会议
        collective_discuss_data_storage.other_speak,//发言类型
        collective_discuss_data_storage.spokesman,
        collective_discuss_data_storage.speak_content,
    ).then(res=>{
        speak_Data.value=res.data.data;
        if (res.data.message === "success"){
            getData()
            ElMessage.success('添加成功');
        }else {
            ElMessageBox.confirm('添加失败', '提示', {
                type: 'warning'
            })
        }});
}



//发言内容删除
const speak_data_delete=(index:number,row:any)=>{
    // 二次确认删除
    ElMessageBox.confirm('确定要删除吗？', '提示', {
        type: 'warning'
    }).then(()=>{
        speak_data_clause_delete(row.id).then(res=>{
            if (res.data.message === "success"){
                speak_Data.value.splice(index, 1);
                ElMessage.success('删除成功');
            }else{
                ElMessageBox.confirm('删除失败', '提示', {
                    type: 'warning'
                })
            }
        })
    })
        .catch(() => {});
}


//讨论
const agree_discuss=(row:any)=>{
    if(row.tcs_note_id=="撤案集体讨论准备"){
        create_case.case_id=row.case_id;
        create_case.tcs_note="撤案集体讨论已开始"
        fetchData_case_update(create_case.case_id,create_case.tcs_note).then(res=>{
            if (res.data.message === "success"){
                ElMessage.success('撤案集体讨论已开始');
                getData();
            }else {
                ElMessageBox.confirm('状态更新失败', '提示', {
                    type: 'warning'
                })
            }
        })
    }else{
        create_case.case_id=row.case_id;
        create_case.tcs_note="集体讨论已开始"
        fetchData_case_update(create_case.case_id,create_case.tcs_note).then(res=>{
            if (res.data.message === "success"){
                ElMessage.success('集体讨论已开始');
                getData();
            }else {
                ElMessageBox.confirm('状态更新失败', '提示', {
                    type: 'warning'
                })
            }
        })
    }

}

const get_collective_discuss_data_storage=(row:any)=>{
    collective_discuss_data(row.case_id).then(res=>{
        collective_discuss_data_storage.case_number=res.data.data.case_number;
        collective_discuss_data_storage.tir_person=res.data.data.tir_person;
        collective_discuss_data_storage.punish_decision1=res.data.data.punish_decision1;
        //案由
        res.data.data.list1.forEach(function (item) {
            collective_discuss_data_storage.case_cause = collective_discuss_data_storage.case_cause + item.illegal_behavior + '、'
        });
    })
}

const collective_discuss=(row:any)=>{
    create_case.case_id=row.case_id;
    collective_discuss_browse_data.current_state=row.tcs_note_id;
    get_collective_discuss_data_storage(row);
    get_illegal_behavior_clause_opinion();
    get_speak_Data();
    Dollective_discuss_Visible.value = true;
}

//查看集体讨论信息
const collective_discuss_browse=(row:any)=>{
    create_case.case_id=row.case_id;
    group_discussion_storage_data.ciga_data_all=''
    group_discussion_storage_data.evi_data_all =''
    group_discussion_storage_data.evi_data_all_1=''
    group_discussion_storage_data.ciga_data_t =''
    group_discussion_storage_data.evi_ciga_t =''
    group_discussion_storage_data.ciga_data_f =''
    group_discussion_storage_data.evi_ciga_f=''
    get_collective_discuss_browse_data();
    get_group_discuss_tabel_browse_data(row);
    Collective_discuss_list_Browse_Visible.value = true;
}


//不讨论
const refuse_discuss=(row:any)=>{
    create_case.case_id=row.case_id;
    if(row.tcs_note_id=="撤案集体讨论准备"){
        create_case.tcs_note="已完成"
        fetchData_case_update(create_case.case_id,create_case.tcs_note).then(res=>{
            if (res.data.message === "success"){
                ElMessage.success('案件已完成');
                getData();
            }else {
                ElMessageBox.confirm('状态更新失败', '提示', {
                    type: 'warning'
                })
            }
        })
    }else{
        create_case.tcs_note="案件处理审批已开始"
        fetchData_case_update(create_case.case_id,create_case.tcs_note).then(res=>{
            if (res.data.message === "success"){
                ElMessage.success('案件处理审批已开始');
                getData();
            }else {
                ElMessageBox.confirm('状态更新失败', '提示', {
                    type: 'warning'
                })
            }
        })
    }

}

//不听证
const refuse_hearing=(row:any)=>{
    create_case.case_id=row.case_id;
    create_case.tcs_note="案件处理审批已开始"
    fetchData_case_update(create_case.case_id,create_case.tcs_note).then(res=>{
        if (res.data.message === "success"){
            ElMessage.success('案件处理审批已开始');
            getData();
        }else {
            ElMessageBox.confirm('状态更新失败', '提示', {
                type: 'warning'
            })
        }
    })
}

//听证
const agree_hearing=(row:any)=>{
    create_case.case_id=row.case_id;
    create_case.tcs_note="听证已开始"
    fetchData_case_update(create_case.case_id,create_case.tcs_note).then(res=>{
        if (res.data.message === "success"){
            ElMessage.success('听证已开始');
            getData();
        }else {
            ElMessageBox.confirm('状态更新失败', '提示', {
                type: 'warning'
            })
        }
    })
}


const certain_collective_discuss=()=>{
    if(collective_discuss_browse_data.current_state=="撤案集体讨论已开始"){
        if (collective_discuss_data_storage.start_date_of_filing.length==0){
            alert("请输入会议开始时间")
        }else if(collective_discuss_data_storage.end_date_of_filing.length==0){
            alert("请输入会议结束时间")
        }else if(collective_discuss_data_storage.host_staff.length==0){
            alert("请选择会议主持人")
        }else if(collective_discuss_data_storage.recorder_staff.length==0){
            alert("请选择会议记录人")
        }else{
            create_case.tcs_note = "已完成"
            fetchData_collective_discuss_Confirm(
                create_case.case_id,
                collective_discuss_data_storage.case_cause,
                collective_discuss_data_storage.case_number,
                collective_discuss_data_storage.tir_person,
                collective_discuss_data_storage.start_date_of_filing,
                collective_discuss_data_storage.end_date_of_filing,
                collective_discuss_data_storage.discuss_address,
                collective_discuss_data_storage.host_staff,
                collective_discuss_data_storage.recorder_staff,
                collective_discuss_data_storage.attend_person_all,
                collective_discuss_data_storage.sit_attend_person_all,
                collective_discuss_data_storage.punish_decision1,
                collective_discuss_data_storage.crime_number
            ).then(res=>{
                if (res.data.message === "success"){
                    getData();
                    fetchData_case_update(create_case.case_id,create_case.tcs_note).then(res=>{
                        if (res.data.message === "success"){
                            ElMessage.success('案件已完成');
                            getData();
                            Dollective_discuss_Visible.value = false;
                        }else {
                            ElMessageBox.confirm('状态更新失败', '提示', {
                                type: 'warning'
                            })
                        }
                    })
                }else {
                    ElMessageBox.confirm('确认失败', '提示', {
                        type: 'warning'
                    })
                }
            });
        }
    }else{
        if (collective_discuss_data_storage.start_date_of_filing.length==0){
            alert("请输入会议开始时间")
        }else if(collective_discuss_data_storage.end_date_of_filing.length==0){
            alert("请输入会议结束时间")
        }else if(collective_discuss_data_storage.host_staff.length==0){
            alert("请选择会议主持人")
        }else if(collective_discuss_data_storage.recorder_staff.length==0){
            alert("请选择会议记录人")
        }else{
            create_case.tcs_note = "集体讨论已完成"
            fetchData_collective_discuss_Confirm(
                create_case.case_id,
                collective_discuss_data_storage.case_cause,
                collective_discuss_data_storage.case_number,
                collective_discuss_data_storage.tir_person,
                collective_discuss_data_storage.start_date_of_filing,
                collective_discuss_data_storage.end_date_of_filing,
                collective_discuss_data_storage.discuss_address,
                collective_discuss_data_storage.host_staff,
                collective_discuss_data_storage.recorder_staff,
                collective_discuss_data_storage.attend_person_all,
                collective_discuss_data_storage.sit_attend_person_all,
                collective_discuss_data_storage.punish_decision1,
                collective_discuss_data_storage.crime_number
            ).then(res=>{
                if (res.data.message === "success"){
                    getData();
                    fetchData_case_update(create_case.case_id,create_case.tcs_note).then(res=>{
                        if (res.data.message === "success"){
                            ElMessage.success('集体讨论已完成');
                            getData();
                            Dollective_discuss_Visible.value = false;
                        }else {
                            ElMessageBox.confirm('状态更新失败', '提示', {
                                type: 'warning'
                            })
                        }
                    })
                }else {
                    ElMessageBox.confirm('确认失败', '提示', {
                        type: 'warning'
                    })
                }
            });
        }
    }


}




const img_form_data = reactive({
    case_number: '',
    name:'',
    content:'',
    remark:'',
    img:'',
});
const img = [];
const handleChange = (file) =>{
    img.push(file);
}
const handleRemove = (file) =>{
    img.forEach(function (item,index,arr){
        if (item.name == file.name){
            img.splice(index,1)
        }
    })
}


const advice_note_views = (row:any) =>{
    img_form_data.case_number = row.case_number;
    fetchData_s_mongodb_evidence_Views(row.case_number,"证据先行保存通知书").then(res => {
        img_form_data.img=res.data.data[0].img
        console.log(img_form_data.img)

    });
    Advice_note_Views_Visible.value=true;
}


const query = reactive({
    case_id:0,
    case_source:'',
    case_type:'',
    tcs_note_id:'',
    case_number:'',
    pageIndex: 1,
    pageSize: 10
});
const tableData = ref<TableItem[]>([]);
const tableList = ref<TableItem[]>([]); // 用于存放分页数据的列表
const pageTotal = ref(0);
const name = localStorage.getItem('ms_username');
// 获取表格数据
const getData = (archive_person:string='',case_id:number,case_source:string='',case_type:string='',case_number:string='',tcs_note_id:string='',name:string='') => {
    fetchData_case(archive_person,case_id,case_source,case_type,case_number,tcs_note_id,name).then(res => {
        tableData.value = res.data.data.filter((i: { tcs_note_id: string; }) =>(
            i.tcs_note_id =="无证经营公示已完成" ||
            i.tcs_note_id=="调查终结文书已完成"||
            i.tcs_note_id=="案件处理审批已开始"||
            i.tcs_note_id=="集体讨论已开始"||
            i.tcs_note_id=="集体讨论已完成"||
            i.tcs_note_id=="听证已开始"||
            i.tcs_note_id=="听证告知书已完成"||
            i.tcs_note_id=="听证已完成"||
            i.tcs_note_id=="案件处理审批已完成"||
            i.tcs_note_id=="行政处罚事先告知书确认完成"||
            i.tcs_note_id=="行政处罚事先告知书已完成"||
            i.tcs_note_id=="行政处罚决定书确认完成"||
            i.tcs_note_id=="行政处罚决定书已完成"||
            i.tcs_note_id=="行政罚款收据上传完成"||
            i.tcs_note_id=="行政罚款收据已完成"||
            i.tcs_note_id=="结案报告表已完成"||
            i.tcs_note_id=="已完成"||
            i.tcs_note_id=="撤案集体讨论准备"||
            i.tcs_note_id=="撤案集体讨论已开始"
        )  )
      tableList.value = [];
      pageTotal.value = tableData.value.length || 50;
      // 根据页码确定下标位置
      const index: number = query.pageIndex * query.pageSize - query.pageSize;
      for (let i = index; i < index + query.pageSize; i++) {
        // 防止数组下标越界
        if (i <= tableData.value.length - 1) {
          tableList.value.push(tableData.value[i])
        } else {
          // 越界就不再循环
          break;
        }
      }
    });
};
getData('','','','','','',localStorage.getItem('ms_username'));
// 查询操作
const handleSearch = (case_number:string='',tcs_note_id:string='',case_source:string='',case_type:string='') => {
    getData('','',case_source,case_type,case_number,tcs_note_id,name);
};
// 分页导航
const handlePageChange = (val: number) => {
  query.pageIndex = val;
    getData('','','','','','',localStorage.getItem('ms_username'));
};
</script>

<style scoped>
.handle-box {
    margin-bottom: 20px;
}


.handle-select {
    width: 120px;
}

.handle-input {
    width: 300px;
}
.table {
    width: 100%;
    font-size: 14px;
}
.red {
    color: #ff0000;
}
.handle-box button{
    background-color: #00a854;
}
:deep(.avatar){
    width: 100px;
    height: 100px;
}
.blue {
    color: rgba(0, 118, 252, 0.79);
}
.mr10 {
    margin-right: 10px;
}
.table-td-thumb {
    display: block;
    margin: auto;
    width: 40px;
    height: 40px;
}
.dialog-footer button{
    background-color: #00a854;
    color:white;
}
/*#inspect_record{*/
/*  position: relative;*/
/*  left: 0px;*/
/*  top: -20px;*/

/*}*/

/*#filing_report_review{*/
/*  position: relative;*/
/*  left: 0px;*/
/*  top: -22px;*/
/*}*/
</style>
